<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <style>
  @font-face {
    font-family: 'iconfont';  /* project id 2462263 */
    src: url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.eot');
    src: url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.eot?#iefix') format('embedded-opentype'),
    url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.woff2') format('woff2'),
    url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.woff') format('woff'),
    url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.ttf') format('truetype'),
    url('//at.alicdn.com/t/font_2462263_zewfkweu5yj.svg#iconfont') format('svg');
}
.a{
  width: 500px;
  margin: 0px auto;
}
.b{
  width: 300px;
  height: 30px;
}
.c{
    display: inline-block;
    font-family: 'iconfont';
    color: rgba(255, 9, 9, 1);
  }
</style>
</head>
<body>
  <div class="a">
    <input type="password" class="b">
    <div class="c">&#xe600;</div>
  </div>
  <script>
    var b=document.querySelector('.b');
    var c=document.querySelector('.c');
    var a=0;
    c.onclick=function(){
      if(a==0)
      {
      b.type='text';
      a=1;
      }
      else{
      b.type='password';
      a=0;
      }
    }
  </script>
</body>
</html>